{{- $version := "8.2.1" }}
{{- $image_version := $version | replace "." "-" }}
---
image: {{ $.ModuleName }}/{{ $.ImageName }}-{{ $image_version }}
from: {{ $.Images.BASE_SCRATCH }}
import:
- artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $image_version }}
  add: /
  to: /
  includePaths:
  - d8-curl
  - install
  - uninstall
  before: setup
docker:
  LABEL:
    distro: all
    version: all
    curl: {{ $version }}
---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $image_version }}
from: {{ $.Images.BASE_ALPINE_DEV }}
git:
  - add: /{{ $.ModulePath }}modules/007-{{ $.ModuleName }}/images/{{ $.ImageName }}/scripts
    to: /
    stageDependencies:
      setup:
      - '**/*'
shell:
  setup:
  - export CC=clang
  - git clone --depth 1 --branch curl-{{ $version | replace "." "_"}} {{ $.SOURCE_REPO }}/curl/curl.git
  - cd /curl
  - autoreconf -fi
  - LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-ldap --enable-ipv6 --enable-unix-sockets --with-ssl --with-libssh2
  - make -j4 V=1 LDFLAGS="-static -all-static"
  - strip src/curl
  - mv src/curl /d8-curl
  - chmod +x /d8-curl /install /uninstall
